<?php
/**
 * Provides an abstract Interface to create a SQL statement
 */
abstract class SqlStatement
{
    protected $sql;         // stores the SQL instruction
    protected $criteria;    // stores the select criteria
    protected $entity;
    
    /**
     * defines the database entity name
     * @param $entity Name of the database entity
     */
    final public function setEntity($entity)
    {
        $this->entity = $entity;
    }
    
    /**
     * Returns the database entity name
     */
    final public function getEntity()
    {
        return $this->entity;
    }
    
    /**
     * Define a select criteria
     * @param $criteria  An Criteria object, specifiyng the filters
     */
    public function setCriteria(Criteria $criteria)
    {
        $this->criteria = $criteria;
    }
    
    // force method rewrite in child classes
    abstract function getInstruction();
}
?>